using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace MiniAnimation
{

    public class TestMiniAnim : MonoBehaviour
    {
        Vector2 originPosi;
        RectTransform rectTrans;
        [SerializeField] MiniCurve curve;
        MiniAnim miniAnim;



        private void Awake()
        {
            rectTrans = GetComponent<RectTransform>();
            originPosi = rectTrans.anchoredPosition;
            DebugAction.AddAction("运动测试", async () =>
            {
                rectTrans.anchoredPosition = originPosi;
                miniAnim?.Kill();
                miniAnim = (transform as RectTransform).MiniAncMove(new Vector3(originPosi.x + rectTrans.rect.width * 1, originPosi.y), .3f, MiniCurve.OutBack);
                miniAnim.SetCurve(curve);
                miniAnim.RegisterCompleted(() =>
                {
                    Debug.Log("动画结束");
                });


            });
        }
    }

}